package com.sinosoft.controller;

import com.alibaba.fastjson.JSONObject;
import com.sinosoft.domain.Customerdo;
import com.sinosoft.service.CustomerdoService;
import com.sinosoft.utils.JsonData;
import com.sinosoft.utils.SyncCustomerRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: WangShengJie
 * @Date: 2025/2/13
 */
@Slf4j
@RestController
@RequestMapping("/customer")
public class CustomerdoController {

    @Autowired
    private CustomerdoService customerdoService;

    @PostMapping(value = "/addCustomer")
    @ResponseBody
    public JsonData addCustomer(@RequestBody Customerdo customerdo) {
      return  customerdoService.addCustomer(customerdo);
    }

    @RequestMapping("/syncCustomers")
    public String syncCustomers(@RequestBody JSONObject jsonObject){

        log.info("请求参数:{}",jsonObject);
        SyncCustomerRequest customerRequest = jsonObject.toJavaObject(SyncCustomerRequest.class);
        System.out.println(customerRequest);
        return "**";
    }

}
